/**
 * 显示帧频
 */
Stats = function(){
	TextField.call( this );
	
	this.align = TextFieldAlign.LEFT ;
	this.font="normal 15px Arial";
	this.color = "#ffffff"; //白色
	
	var time= 0;
	var date ;
	var fps=0;
	var interval=0;
	var _self =this ;
	
	function update(){
		interval++;
		date = new Date();
		fps = ( 1000/(date.getTime()-time))>>0  ;
		time = date.getTime() ;
		if(interval==0 || interval==20){
			_self.text  = "fps:"+ fps +"/"+ FlashCore.stage._frameRate  ;
			interval =0;
		}
	};
	
	
	function remove(e){
		_self.removeEventListener(Event.ENTER_FRAME , update);
		_self.removeEventListener(Event.REMOVED_FROM_STAGE , remove );
		_self.dispose();
	};
	this.addEventListener(Event.ENTER_FRAME , update);
	this.addEventListener(Event.REMOVED_FROM_STAGE , remove );
};

FLASH.extend( Stats , TextField );